package com.jake.spring.config;

import com.jake.spring.domain.AwarePerson;
import com.jake.spring.domain.NoAwarePerson;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class PersonConfig {

    /**
     * 如果不配置@Bean的name属性，那么默认的beanName为方法名
     */
    @Bean(name = "awarePerson")
    AwarePerson awarePerson() {
        AwarePerson person = new AwarePerson();
        person.setPid(1);
        person.setName("Jake");
        person.setAddress("德意名居");
        return person;
    }

    @Bean
    NoAwarePerson noAwarePerson() {
        NoAwarePerson person = new NoAwarePerson();
        person.setPid(1);
        person.setName("Jake");
        person.setAddress("德意名居");
        return person;
    }

}
